package com.my.pojo;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.util.List;

/**
 * @Author: jiChen
 * @Description: 用户登录信息实体类
 * @Date: 2021/11/29 8:20 上午
 */

@Entity
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Table(name = "user")
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Integer userId;

    @Column(name = "username")
    private String username;

    @Column(name = "password")
    private String password;

    @Column(name = "phone")
    private String phone;

    @Column(name = "face")
    private String face;

    @Column(name = "email")
    private String email;

    @Column(name = "status")
    private Integer status;

    @OneToOne(orphanRemoval = true, fetch = FetchType.LAZY)
    private Person person;

    @OneToMany(mappedBy = "user")
    private List<Address> address;

    @OneToMany(mappedBy = "address")
    private List<Orders> orders;

    @OneToOne(orphanRemoval = true, fetch = FetchType.LAZY)
    private Vip vip;

    @OneToMany(mappedBy = "user")
    private List<ShopCart> shopCartList;

}
